﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class MemberInfo : OTS.MemberPage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!TestLogin(HttpContext.Current))
            return;
        if (!Page.IsPostBack)
        {
            OTS.Model.custom model = GetCustom(HttpContext.Current);
            this.lblName.Text = model.cusLoginName;
            this.lblEmail.Text = model.cusEmail;

            OTS.BLL.CustomBLL bll = new OTS.BLL.CustomBLL();
            OTS.Model.customInfo info = bll.GetCustomlInfo(model.cusID);
            this.txtProvince.Text = info.cusProvince;
            this.txtCity.Text = info.cusCity;
            this.txtArea.Text = info.cusArea;
            this.txtName.Text = info.cusName;
            this.rdSex.SelectedValue = info.cusSex;
            this.txtAddress.Text = info.cusAdress;
            this.txtPhone.Text = info.cusPhone;
            this.txtQQ.Text = info.cusQQ;
            this.txtPostCode.Text = info.cusPostCode;
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        OTS.Model.customInfo info = new OTS.Model.customInfo();
        info.cusProvince = this.txtProvince.Text;
        info.cusCity = this.txtCity.Text;
        info.cusArea = this.txtArea.Text;
        info.cusName = this.txtName.Text;
        info.cusSex = this.rdSex.SelectedValue;
        info.cusAdress = this.txtAddress.Text;
        info.cusPostCode = this.txtPostCode.Text;
        info.cusPhone = this.txtPhone.Text;
        info.cusQQ = this.txtQQ.Text;
        info.cusBirthDay = "";
        info.cusBirthYear = "";
        info.cusBirthMonth = "";
        OTS.Model.custom model = GetCustom(HttpContext.Current);
        info.cusID = model.cusID;

        OTS.BLL.CustomBLL bll = new OTS.BLL.CustomBLL();
        if (bll.UpdateInfo(info))
        {
            this.lblMsg.Text = "保存成功！";
            return;
        }
        else
        {
            this.lblMsg.Text = "保存失败！";
            return;
        }
    }
}
